class comments {
  late int code;
  late String msg;
  late Data data;

  comments({required this.code, required this.msg, required this.data});

  comments.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    msg = json['msg'];
    data = (json['data'] != null ? new Data.fromJson(json['data']) : null)!;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['msg'] = this.msg;

    data['data'] = this.data.toJson();

    return data;
  }
}

class Data {
  late List<Comments> comments;
  late String targetNoteId;
  late String targetNoteUserId;
  late int commentsLevel1Count;
  late int commentsTotal;
  late int pageSize;

  Data(
      {required this.comments,
      required this.targetNoteId,
      required this.targetNoteUserId,
      required this.commentsLevel1Count,
      required this.commentsTotal,
      required this.pageSize});

  Data.fromJson(Map<String, dynamic> json) {
    if (json['comments'] != null) {
      comments = [];
      json['comments'].forEach((v) {
        comments.add(new Comments.fromJson(v));
      });
    }
    targetNoteId = json['targetNoteId'];
    targetNoteUserId = json['targetNoteUserId'];
    commentsLevel1Count = json['commentsLevel1Count'];
    commentsTotal = json['commentsTotal'];
    pageSize = json['pageSize'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();

    data['comments'] = this.comments.map((v) => v.toJson()).toList();

    data['targetNoteId'] = this.targetNoteId;
    data['targetNoteUserId'] = this.targetNoteUserId;
    data['commentsLevel1Count'] = this.commentsLevel1Count;
    data['commentsTotal'] = this.commentsTotal;
    data['pageSize'] = this.pageSize;
    return data;
  }
}

class Comments {
  late List<String> ats;
  late String content;
  late List<String> hashTags;
  late String id;
  late int likes;
  late bool isLiked;
  late String targetNoteId;
  late List<SubComments> subComments;
  late int subCommentsTotal;
  late String time;
  late User user;

  Comments(
      {required this.ats,
      required this.content,
      required this.hashTags,
      required this.id,
      required this.likes,
      required this.isLiked,
      required this.targetNoteId,
      required this.subComments,
      required this.subCommentsTotal,
      required this.time,
      required this.user});

  Comments.fromJson(Map<String, dynamic> json) {
    if (json['ats'] != null) {
      ats = [];
      json['ats'].forEach((v) {
        ats.add(v);
      });
    }
    content = json['content'];
    if (json['hashTags'] != null) {
      hashTags = [];
      json['hashTags'].forEach((v) {
        hashTags.add(v);
      });
    }
    id = json['id'];
    likes = json['likes'];
    isLiked = json['isLiked'];
    targetNoteId = json['targetNoteId'];
    if (json['subComments'] != null) {
      subComments = [];
      json['subComments'].forEach((v) {
        subComments.add(new SubComments.fromJson(v));
      });
    }
    subCommentsTotal = json['subCommentsTotal'];
    time = json['time'];
    user = (json['user'] != null ? new User.fromJson(json['user']) : null)!;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();

    data['ats'] = this.ats.map((v) => v).toList();

    data['content'] = this.content;

    data['hashTags'] = this.hashTags.map((v) => v).toList();

    data['id'] = this.id;
    data['likes'] = this.likes;
    data['isLiked'] = this.isLiked;
    data['targetNoteId'] = this.targetNoteId;

    data['subComments'] = this.subComments.map((v) => v.toJson()).toList();

    data['subCommentsTotal'] = this.subCommentsTotal;
    data['time'] = this.time;

    data['user'] = this.user.toJson();

    return data;
  }
}

class SubComments {
  late List<String> ats;
  late String content;
  late List<Null> hashTags;
  late String id;
  late String targetCommentId;
  late bool isLiked;
  late int likes;
  late String time;
  late User user;

  SubComments(
      {required this.ats,
      required this.content,
      required this.hashTags,
      required this.id,
      required this.targetCommentId,
      required this.isLiked,
      required this.likes,
      required this.time,
      required this.user});

  SubComments.fromJson(Map<String, dynamic> json) {
    if (json['ats'] != null) {
      ats = [];
      json['ats'].forEach((v) {
        ats.add(v);
      });
    }
    content = json['content'];
    if (json['hashTags'] != null) {
      hashTags = [];
      json['hashTags'].forEach((v) {
        hashTags.add(v);
      });
    }
    id = json['id'];
    targetCommentId = json['targetCommentId'];
    isLiked = json['isLiked'];
    likes = json['likes'];
    time = json['time'];
    user = (json['user'] != null ? new User.fromJson(json['user']) : null)!;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();

    data['ats'] = this.ats.map((v) => v).toList();

    data['content'] = this.content;

    data['hashTags'] = this.hashTags.map((v) => v).toList();

    data['id'] = this.id;
    data['targetCommentId'] = this.targetCommentId;
    data['isLiked'] = this.isLiked;
    data['likes'] = this.likes;
    data['time'] = this.time;

    data['user'] = this.user.toJson();

    return data;
  }
}

class User {
  late String id;
  late String image;
  late String nickname;

  User({required this.id, required this.image, required this.nickname});

  User.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    image = json['image'];
    nickname = json['nickname'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['image'] = this.image;
    data['nickname'] = this.nickname;
    return data;
  }
}
